local extension = Package("kaman__cards", Package.CardPack)
extension.extensionName = "decade"

Fk:loadTranslationTable{
  ["kaman__cards"] = "骑士卡",
}

local kaman__huoyan_skill = fk.CreateTriggerSkill{
  name = "#kaman__huoyan_skill",
  attached_equip = "kaman__huoyan",
  frequency = Skill.Compulsory,
  events = {fk.DamageCaused},
  
  can_trigger = function(self, event, target, player, data)
    return event == fk.DamageCaused and 
      data.from == player and 
      player:hasSkill(self) and  -- 检查是否有此技能（即是否装备武器）
      data.card and 
      data.card.trueName == "slash"
  end,

  on_use = function(self, event, target, player, data)
    data.damage = data.damage + 1  -- 伤害+1
    data.damageType = fk.FireDamage -- 强制转为火杀
    player.room:notifySkillInvoked(player, self.name)
  end
}

local kaman__huoyan_tmod = fk.CreateTargetModSkill{
  name = "#kaman__huoyan_tmod",
  attached_equip = "kaman__huoyan",
  bypass_times = function(self, player, skill, scope)
    if skill.trueName == "slash_skill" and 
      scope == Player.HistoryPhase and
      player:hasSkill("#kaman__huoyan_skill") then  -- 检查是否装备武器
      return 999  -- 极大值实现无限出杀
    end
  end
}

kaman__huoyan_skill:addRelatedSkill(kaman__huoyan_tmod)
Fk:addSkill(kaman__huoyan_skill)

local kaman__huoyan = fk.CreateWeapon{  
    name = "kaman__huoyan", 
    suit = Card.Diamond,
    number = 7, 
    -- 明确攻击范围为 2
    attack_range = 2,
    equip_skill = kaman__huoyan_skill,
}

Fk:loadTranslationTable{
    ["kaman__huoyan"] = "火炎剑烈火",
    [":kaman__huoyan"] = [[<b>牌名：</b>火炎剑烈火
<b>类型：</b>装备牌·武器
<b>攻击范围：</b>2
<b>武器技能：</b>锁定技，你使用的【杀】总是视为伤害+1的火杀；你使用【杀】无次数限制]],
    ["#kaman__huoyan_skill"] = "火炎剑烈火",
}
 
  extension:addCards({kaman__huoyan})

  return extension

